<template>
  <!-- 新增录入画面对话框-->
  <el-dialog
    :title="title"
    center
    :visible.sync="openState"
    width="1024px"
    :close-on-click-modal="false"
 >
    <div class="app-container">
      <ht-search-form
        :dictMap="dictMap"
        :queryParams="queryParams"
        :outputQueryParams="queryParams"
        :formOptions="formOptions"
        :advOptions="[]"
        :defaultEventKey="dealsearch"
      >
      </ht-search-form>
      <ht-table
        ref="dealdataTable"
        :randomRowKey="true"
        :showSerialNumber="false"
        :multi-select="false"
        :dictMap="dictMap"
        :reqConfig="reqConfig"
        :queryParams="queryParams"
        :tableBindColumns="tableBindColumns"
        :defaultEventKey="dealsearch"

      >
        <template v-slot:operate>
          <el-table-column label="操作" align="left" width="80" fixed="right" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <ht-button-group
                :buttonList="[
                {
                  label: '明细',
                  doFunc: () => {
                    toViewDetail(scope.row);
                  },
                }
              ]"
              />
            </template>
          </el-table-column>
        </template>
      </ht-table>
      <edit-info-dialog ref="editInfoDialog" :dictMap="dictMap" @editComplete="editComplete"></edit-info-dialog>

    </div>
  </el-dialog>

</template>
<script>
import HtAmountInput from "@/views/components/HtAmountInput";
import HtAmountUpper from "@/views/components/HtAmountUpper";
import {
  apiUrlQueryDetailConfig,

} from "@/api/cnaps/bizMng/batchFileUpload";
import EditInfoDialog from "@/views/cnaps/bizMng/batchFile/batchFileQuery/EditInfo";

export default {
  name: "DealSearch",
  components: {
    EditInfoDialog,
    HtAmountInput,
    HtAmountUpper,
  },
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },

  data() {
    return {
      reqConfig: apiUrlQueryDetailConfig ,
      total: 0,
      dataList: [],
      dealsearch:"dealsearch",
      //数据字典
      searchFormDictList: [
        "Cnaps2Dict.DRCTCODE",
        "BIZ_TYPE_111",
        "BIZ_CTGY",
        "PRIORITY3CODE",

      ],

      id:"",
      openState: false,
      // 弹出层标题
      title: "",
      showSearch: true,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        id:"",
        custId:"",
        pkgId:"",
        status:""
      },
      formOptions: [],

      tableBindColumns: [
        { label: `行内系统序号`, prop: "custId", width: "170" },
        { label: `报文标识号`, prop: "pkgId", width: "170" },
        { label: `来往账方向`, prop: "drct",dictCode: "Cnaps2Dict.DRCTCODE", width: "120" },
        { label: `交易货币`, prop: "curcd", width: "170" },
        { label: `金额`, prop: "amount",type:"price", width: "170" },
        { label: `付款人`, prop: "payerName", width: "160", sortable: false },
        { label: `付款账号`, prop: "payerActno", width: "160" },
        { label: `收款人`, prop: "payeeName", width: "160", sortable: false },
        { label: `收款账号`, prop: "payeeActno", width: "160" },
        { label: `审核状态`, prop: "status",dictCode: "FILE_STATUS",fixed: "right"},
      ],
    };
  },
  computed: {

  },
  created() {
  },
  mounted() {
    this.formOptions = [
      {
        type: "input",
        prop: "custId",
        defaultAttr: {
          label: "行内系统序号",
          placeholder: "请输入行内系统序号",
        },
      },
      {
        type: "input",
        prop: "pkgId",
        defaultAttr: {
          label: "报文标识号",
          placeholder: "请输入报文标识号",
        },
      },
      {
        type: "dict",
        dict:"FILE_STATUS",
        prop: "status",
        defaultAttr: {
          label: "审核状态",
          placeholder: "请输入审核状态",
        },
      }
    ];
  },
  methods: {
    editComplete(state) {
      console.log("editComplete", state);
      if (state == true) {
        this.getList();
      }
    },

    /** todo 查询当天操作员的交易记录 */
    getList() {
      this.$refs.dealdataTable.doQuery();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    /*审核明细*/
    toViewDetail(row) {
      this.$refs.editInfoDialog.show(row.id);
    },

    show(id = "") {
      this.id = id;
      this.title = "交易记录信息";
      this.openState = true;
      this.$set(this.queryParams,"id",id)
      this.$refs.dealdataTable.doQuery(true);

    },
  },
};
</script>
<style>
.app-container {
  overflow: scroll;
  height: 700px;
}
.dialog-footer {
  margin: 10px 0;
  text-align: center;
}
</style>
